export const localStorageGet = (key: string) => {
    const val = localStorage.getItem(key)
    try {
        return JSON.parse(val)
    } catch (e) {
        return val;
    }
}
export const localStorageSet = (key: string, value: any) => {
    localStorage.setItem(key, value)
}
export const localStorageRemove = (key: string) => {
    localStorage.removeItem(key)
}
export function useLocalStorage(key: string) {
    return {
        get: () => localStorageGet(key),
        set: (val: any) => localStorageSet(key, val),
        remove: () => localStorageRemove(key)
    }
}